<!DOCTYPE html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en">
	<!--<![endif]-->
	<head>
		<meta charset="utf-8" />

		<!-- Set the viewport width to device width for mobile -->
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Login</title>
		<!-- Included CSS Files (Compressed) -->
		<link rel="stylesheet" href="foundation/stylesheets/foundation.min.css">
		<link rel="stylesheet" href="foundation/stylesheets/app.css">
		
		<script src="foundation/javascripts/modernizr.foundation.js"></script>

		<!-- IE Fix for HTML5 Tags -->
		<!--[if lt IE 9]>
		<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
		<![endif]-->
	</head>
<%
	String loginError = request.getParameter("login_error");

	/*
	 * If we are not coming back after an error store the initial referring page, we will redirect to this page once
	 * the login is successful.
	 */
	if (!"true".equals(loginError)) {
		session.setAttribute("redirect", request.getHeader("referer"));
	}
	//String username = request.getParameter("username");
	//if (username == null) {
	//	username = "";
	//}
%>
<body>
	<nav class="top-bar">
		<ul>
			<li class="name">
				<h1><a href="http://www.magneato.org/">Magneato CMS</a></h1>
			</li>
		</ul>
	</nav>
	
	
	<div class="twelve columns">
		<div class="row">
			<h1><small>Not Authorized</small></h1>		
			<p>This page is only accessible to logged-in users with proper access privileges</p>
		</div>

	
		<div class="row">
		
			<div class="six columns">
				<fieldset>
					<legend>Please sign in</legend>
			
					<form name="loginform" id="loginForm" name="f" action="j_spring_security_check" method="post" >			
						<div class="row">
							<label for="j_username">Username</label>
							<input class="input-text" type="text" name="j_username" id="j_username" />
						</div>
						
						<div class="row">
							<label for="j_password">Password</label>
							<input class="input-text" type="password" name="j_password" id="j_password" />
							<%
								if ("true".equals(loginError)) {
							%>
								<div class="alert-box alert">Username or Password incorrect, please try again</div>
							<%
							}
							%>
						</div>
					
						<div class="row">			
							<input type='checkbox' name='_spring_security_remember_me' />&nbsp;Remember me on this computer.
						</div>
					
						<div class="row">
							<br><input class="small button" type="submit"  value="Login" />
						</div>
					</form>
					
					<div class="six columns">
						<div class="row">
							<ul class="side-nav">
								<li><a href='register.do'>Register</a></li>
								<li><a href='generateReset.do'>Forgotten Password?</a></li>
							</ul>
						</div>
					</div>	
				</fieldset>
			</div>
		</div>
	</div>
	<!-- Included JS Files (Compressed) -->
	<script src="foundation/javascripts/jquery.js"></script>
	<script src="foundation/javascripts/foundation.min.js"></script>

	<!-- Initialize JS Plugins -->
	<script src="foundation/javascripts/app.js"></script>
	
	<script type="text/javascript" src="js/jquery.cookie.js"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			$.cookie("magUserId", null, {path:'/'});
		});
	</script>
</body>
</html>